package com.demo.fail;

import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * @author 林瑞涛
 * @desc
 * @date 2023年09月22日 14:59
 */
public class FailSafeTest {
    public static void main(String[] args) {
        CopyOnWriteArrayList<Integer> list = new CopyOnWriteArrayList<>(new Integer[]{1, 7, 9, 11});
        Iterator itr = list.iterator();
        while(itr.hasNext()){
            Integer i = (Integer) itr.next();
            System.out.println(i);
            if(i == 7){
                list.add(15);
            }
        }

    }
}
